package com.aiti.lulian.service.impl;

import com.aiti.base.core.base.service.iml.BaseSerivceImpl;
import com.aiti.lulian.dto.MyCollectionDto;
import com.aiti.lulian.entity.MyCollection;
import com.aiti.lulian.entity.ShowEnterpriseServiceEntity;
import com.aiti.lulian.gxmh.vo.GxmhPolicyVo;
import com.aiti.lulian.mapper.ShowActivityInfoMapper;
import com.aiti.lulian.mapper.ShowEnterpriseServiceMapper;
import com.aiti.lulian.mapper.gongxin.FundMapper;
import com.aiti.lulian.mapper.gongxin.MyCollectionMapper;
import com.aiti.lulian.mapper.gongxin.SupplyAndDemandDatabaseMapper;
import com.aiti.lulian.mapper.gxmh.GovArticleMapper;
import com.aiti.lulian.mapper.xlb.XlbEnterpriseMapper;
import com.aiti.lulian.service.IMyCollectionService;
import com.aiti.lulian.vo.ShowActivityInfoVo;
import com.aiti.lulian.vo.gongxin.FundVo;
import com.aiti.lulian.vo.gongxin.SupplyAndDemandVo;
import com.aiti.lulian.vo.xlb.XlbEnterpriseVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyCollectionServiceImpl extends BaseSerivceImpl<MyCollectionMapper, MyCollection> implements IMyCollectionService {

    @Autowired
    private MyCollectionMapper myCollectionMapper;

    @Autowired
    private FundMapper fundMapper;

    @Autowired
    private SupplyAndDemandDatabaseMapper supplyAndDemandDatabaseMapper;

    @Autowired
    private GovArticleMapper govArticleMapper;

    @Autowired
    private ShowEnterpriseServiceMapper showEnterpriseServiceMapper;

    @Autowired
    private ShowActivityInfoMapper activityMapper;

    @Autowired
    private XlbEnterpriseMapper xlbEnterpriseMapper;

    @Override
    public void collect(MyCollectionDto dto) {
        MyCollection myCollection = new MyCollection();
        BeanUtils.copyProperties(dto, myCollection);
        myCollectionMapper.insert(myCollection);
    }

    @Override
    public List<FundVo> getFundCollectionList(Page<FundVo> page, MyCollectionDto dto) {
        return fundMapper.selectFundCollectionList(page, dto);
    }

    @Override
    public List<SupplyAndDemandVo> getSupplyAndDemandCollectionList(Page<SupplyAndDemandVo> page, MyCollectionDto dto) {
        return supplyAndDemandDatabaseMapper.selectSupplyAndDemandCollectionList(page, dto);
    }

    @Override
    public List<GxmhPolicyVo> getGxmhPolicyCollectionList(IPage<GxmhPolicyVo> page, MyCollectionDto dto) {
        return govArticleMapper.selectGxmhPolicyCollectionList(page, dto);
    }

    @Override
    public List<ShowEnterpriseServiceEntity> getServiceCollectionList(Page<ShowEnterpriseServiceEntity> page, MyCollectionDto dto) {
        return showEnterpriseServiceMapper.selectServiceCollectionList(page, dto);
    }

    @Override
    public List<ShowActivityInfoVo> getActivityCollectionList(Page<ShowActivityInfoVo> page, MyCollectionDto dto) {
        return activityMapper.getActivityCollectionList(page, dto);
    }

    @Override
    public List<XlbEnterpriseVo> getXlbEnterpriseCollectionList(IPage<XlbEnterpriseVo> page, MyCollectionDto dto) {
        return xlbEnterpriseMapper.getXlbEnterpriseCollectionList(page, dto);
    }
}
